<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Navigation extends Model
{
    protected $fillable = ['name','parent_id','url','target','sort','status','type'];

    //子分类
    public function childs()
    {
        return $this->hasMany('App\Models\Navigation','parent_id','id');
    }

    //所有子类
    public function allChilds()
    {
        return $this->childs()->with('allChilds');
    }
}
